<?php 
include_once("public/head.php");
$id = $_GET['id'];
@mysql_connect('localhost', 'root', 'root');
mysql_select_db('blog');
mysql_set_charset('utf8');

$sql3 = "update `writing` set `dianji`=`dianji`+1 where `id`=$id";
$res3 = mysql_query($sql3);

$sql = "select * from `writing` where `id`='$id'";//查询博文
$res = mysql_query($sql);

while ($rows = mysql_fetch_assoc($res)) {//博文
    $arr[] = $rows;
}

$sql2 = "select * from `link`";
$res2 = mysql_query($sql2);
while ($rows2 = mysql_fetch_assoc($res2)) {
    $arr2[] = $rows2;
}

$sql4 = "select * from `commen` where wid=$id";
$res4 = mysql_query($sql4);
while ($rows4 = mysql_fetch_assoc($res4)) {
  $arr4[] = $rows4;
}

?>



  <div class="jztop"></div>
  <div class="container">
    <div class="bloglist f_l">
    
<?php 
     echo   '<table width="100%">
     <h3><a href="top.php">'.$arr[0]['title'].'</a></h3>
      <img src="/public/pic/'.$arr[0]['pic'].'" alt="" style = "width:550px">
      
        <p> '.$arr[0]['content'].'</p>
        
      
      <p class="dateview"><span>'.date('Y-m-d h:i:s',$arr[0]['ctime']) .'</span><span>作者：朱雄</span><span>点击量：'.$arr[0]['dianji'].'</span></p>
      </table>';
      
?>
<div class="bloglist f_l">
     <form action="doaddcommen.php" method="post" enctype="multipart/form-data">
     <input type="hidden" name="id" value="<?php echo $id?>">
     <table width="100%">
        <script id="container" name="content" type="text/plain" style="width: 500px">
                                
        </script>         
     </table>
     <!-- 配置文件 -->
                    <script type="text/javascript" src="/public/utf8-php/ueditor.config.js"></script>
                    <!-- 编辑器源码文件 -->
                    <script type="text/javascript" src="/public/utf8-php/ueditor.all.js"></script>
                    <!-- 实例化编辑器 -->
                    <script type="text/javascript">
                        var ue = UE.getEditor('container',{
                          toolbars:[
                          ['emotion']
                          ]
                        });
                          
                    </script>
                <input class="btn btn-primary btn6 mr10" value="畅言一下" type="submit" style="background: #E74851 ;color: #fff;height:35px;width:80px;border-radius: 15px;">
    </form>
    <ul>
    <?php 

    if (isset($arr4)) {
    
   
    foreach ($arr4 as $v) {
       
      echo
      '<li>用户名：'.$v['uname'].'</li>
      <li>评论：'.$v['commen'].'</li>
      <li>评论时间：'.date("Y-m-d h:i:s",$v['ctime']).'</li>
      <li style="color: red;text-align: center;">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</li>';
    }
  } else{
      echo
      '<i><font name="草书" size="5px" color="red">还没有人发表评论，赶紧抢个沙发吧！</font></i>';
    }
    ?>
    </ul>

    </div>
    </div>
    <div class="r_box f_r">
      <div class="tit01">
        <h3 class="tit">关注我</h3>
        <div class="gzwm">
          <ul>
            <!-- <li><a class="email" href="#" target="_blank">我的电话</a></li> -->
            <li><a class="qq" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=hbC1trawtbC2s8X09Kvm6ug" target="_blank">我的邮箱</a></li>
            <li><a class="tel" href="https://user.qzone.qq.com/503350536/infocenter" target="_blank">我的QQ空间</a></li>
            <!-- <li><a class="prize" href="#">个人奖项</a></li> -->
          </ul>
        </div>
      </div>
      <!--tit01 end-->
     
      <div class="ph">
        <h3 class="tit">友情链接</h3>
        <ul class="rank">
          <li><a href="http://image.baidu.com/">百度图片</a></li>
          <?php 
          foreach ($arr2 as $v) {
           echo  '<li><a href="'.$v['url'].'">'.$v['name'].'</a></li>';
           } ?>
          
        </ul>
      </div>
      <div class="ad"> <img src="public/images/1.png"> </div>
    </div>
  </div>
  <!-- container代码 结束 -->
<?php 
include_once("public/after.php");
 ?>